# $Id$
# Maintainer: Jan de Groot <jgc@archlinux.org>

pkgbase=nautilus
pkgname=(nautilus libnautilus-extension)
pkgver=3.26.0
pkgrel=1
pkgdesc="Default file manager for GNOME"
url="https://wiki.gnome.org/Apps/Nautilus"
arch=(i686 x86_64)
license=(GPL)
depends=(libexif gnome-desktop exempi gvfs dconf libtracker-sparql nautilus-sendto gnome-autoar)
makedepends=(gobject-introspection packagekit git gtk-doc meson)
options=(!emptydirs)
_commit=69942c754ea4e45ab0d32bcbc9e29f1c08da8990  # tags/3.26.0^0
source=("git+https://gitlab.gnome.org/GNOME/nautilus.git#commit=$_commit"
        "git+https://git.gnome.org/browse/libgd")
sha256sums=('SKIP'
            'SKIP')

prepare() {
  mkdir -p build libne/usr/{lib,share}
  cd $pkgbase

  git submodule init
  git config --local submodule.libgd.url "$srcdir/libgd"
  git submodule update
}

pkgver() {
  cd $pkgbase
  git describe --tags | sed 's/-/+/g'
}

build() {
  cd build
  export LANG=en_US.UTF-8
  meson --prefix=/usr --buildtype=release ../$pkgbase \
    --sysconfdir=/etc \
    -Denable-exif=true \
    -Denable-xmp=true \
    -Denable-gtk-doc=true \
    -Denable-selinux=false
  ninja
}

package_nautilus() {
  depends+=(libnautilus-extension)
  groups=(gnome)

  cd build
  DESTDIR="$pkgdir" ninja install

### Split libnautilus-extension

  cd ../libne
  mv "$pkgdir"/usr/include usr
  mv "$pkgdir"/usr/lib/{girepository-1.0,libnautilus-extension*,pkgconfig} usr/lib
  mv "$pkgdir"/usr/share/{gir-1.0,gtk-doc} usr/share
}

package_libnautilus-extension() {
  pkgdesc="Library for extending the $pkgdesc"
  depends=(gtk3)
  mv libne/usr "$pkgdir"
}
